package restful.struts2.handler;

import java.io.*;

public class TxtHandler implements ContentTypeHandler {

	public String fromObject(Object obj, String resultCode, Writer stream) {
		try {
			stream.write(obj.toString());
		}
		catch(IOException e) {
			throw new RuntimeException(e);
		}
		return null;
	}

	public String getContentType() {
		return "text/plain";
	}

	public String getExtension() {
		return "txt";
	}

	public Object toObject(Reader in, Object target) {
		throw new UnsupportedOperationException();
	}

	public Object toObject(String in, Object target) {
		throw new UnsupportedOperationException();
	}
}
